$(function () {
    //日期调用
    $('input[action="date"').datetimepicker()
    //layui.upload({elem:'.layui-upload-file'});
    $("#commentForm2").validate({
        rules: {
            firstname: "required",
            lastname: "required",
            username: {
                required: true,
                minlength: 2
            },
            password: {
                required: true,
                minlength: 5
            },
            confirm_password: {
                required: true,
                minlength: 5,
                equalTo: "#password"
            },
            email: {
                required: true,
                email: true
            },
            agree: "required",
            number:{
                required:true,
                number:true
            },
            zs:{
                required:true,
                digits:true
            },
            date:{
                required:true,
                date:true
            },
            inlineRadioOptions:"required",
            interest:"required",
            file:"required",address:"required"
        },
        messages: {
            firstname:  "请输入你的姓",
            lastname: "请输入您的名字",
            username: {
                required:  "请输入您的用户名",
                minlength: "用户名必须两个字符以上"
            },
            password: {
                required:  "请输入您的密码",
                minlength: "密码必须5个字符以上"
            },
            confirm_password: {
                required: "请再次输入密码",
                minlength: "密码必须5个字符以上",
                equalTo: "两次输入的密码不一致"
            },
            email: "请输入您的E-mail",
            agree: {
                required: "必须同意协议后才能注册"
            },inlineRadioOptions:{
                required:'请选择性别'
            },interest:{
                required:'请选择分类'
            },number:{
                required:'请输入数据',
                number:'必需为数据'
            },zs:{
                required:'请输入数据',
                digits:'必需为整数'
            },date:{
                required:'请选择时间',
                digits:'必需为时间'
            },file:'选择上传文件',address:"请选择地址"
        },submitHandler:function(form){
            $(form).ajaxSubmit();
        }
    });
});